<template>
  <view class="page">
  	<view class="qrcode">
  	  <image :src="qrcode" mode="widthFix" class="icon" v-if="qrcode" />
  	
  	  <view class="text"> 设备ID：{{ thingId }} </view>
  	</view>
  </view>
</template>

<script>
import detailModule from "@/common/mixins/detail-module";
import { imgBaseUrlV1 } from "@/common/config";
import { getQrcode } from "@/common/api/base";
export default {
  mixins: [detailModule],
  data() {
    return {
      qrcode: "",
      // qrcode: imgBaseUrlV1 + "exp_qrcode.jpg",
      thingId: "",
      mixinViewOptions: {
        getURL: "/device/detail",
        isPage: false,
        isShowLoading: false,
        reachBottom: false,
        createdIsNeed: false,
        pullDown: false,
      },
    };
  },
  methods: {
    fetchComplete(err, data, res) {
      if (err) return this.message.error(res.message || "获取设备详情失败!");
      this.thingId = data.id;
      return data;
    },
    getQrcode() {
      uni.showLoading({
        title: "加载中",
        icon: "none",
      });
      getQrcode({
        // page: "pageA/equipment-detail/index",
        // page: "pages/tabbar-pages/tabbar-pages",
        page: "pageA/equipment-detail/index",
        scene: "id=" + this.dataForm.deviceId,
      })
        .then((res) => {
          uni.hideLoading();
          if (res.code !== this.$ERR_OK) {
            return this.message.error(res.message || "获取设备二维码失败!");
          }
          console.log(res.data, "???data q");
          this.qrcode = res.data;
        })
        .catch((err) => {
          uni.hideLoading();
        });
    },
  },
  onLoad(e) {
    this.dataForm.deviceId = e.deviceId;

    this.getDataInfo();
    this.getQrcode();
  },
};
</script>

<style lang="stylus" scoped>
@import '~@/common/stylus/variable';

.page {
  width:100%;
  height: 100vh;
  background: linear-gradient(180deg, #0D1523 0%, #102945 100%);	
}
.qrcode {
  margin: 0rpx 24rpx 24rpx;
  // background: linear-gradient(180deg, #0D1523 0%, #102945 100%);
  padding: 15rpx 72rpx 36rpx;
  color: #fff;
  >.icon {
    display: block;
    width: 556rpx;
    height: 556rpx;
    margin: 36rpx 0;
  }

  .text {
    text-align: center;
    font-size: 30rpx;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    line-height: 42rpx;
    color: color-white;
  }
}
</style>